package xdTool

import grails.converters.JSON
import initConfig.SysInitData

class XdDataSource {

    String sourceName
    String driverClassName
    String username
    String password
    String url
    String state = '1'

    String creator ;//操作人
    String updater;//最近一次更新人
    Date dateCreated;
    Date lastUpdated;
    static constraints = {
        creator(nullable: false)
        updater(nullable: true)
    }

    static mapping = {
        version false
    }

    static init(){
        if(XdDataSource.count()==0){
            new XdDataSource(
                    sourceName: "XD-PC-MySql-Test",
                    driverClassName: "com.mysql.jdbc.Driver",
                    username: "root",password: "xxd12345",state: "1",
                    url: "jdbc:mysql://localhost:3306/test?autoReconnect=true&useSSL=true&characterEncoding=utf8",
                    creator: SysInitData.SYS_ADMIN).save(flush: true)
        }
    }
}
